package org.opens.javaskill.easypoi.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Data
@ExcelTarget(value = "childEntity")
public class ChildEntity {

    public static final Random random = new Random(System.currentTimeMillis());

    @Excel(name = "孩子id", width = 20)
    private Integer id;

    @Excel(name = "孩子名称", width = 20)
    private String name;

    public static ChildEntity getRandomOne() {
        ChildEntity department = new ChildEntity();
        department.setId(random.nextInt(1000));
        department.setName("dep " + random.nextInt(1000));
        return department;
    }

    public static List<ChildEntity> getRandomList(int number) {
        List<ChildEntity> result = new ArrayList<>();
        for (int i = 0; i < number; i++) {
            result.add(getRandomOne());
        }
        return result;
    }

}
